package com.example.leetcode.prcatice;

import java.util.ArrayList;
import java.util.List;

public class Test401 {
    /**
     *  bitCount 返回二进制中1的个数    例如3   0011 就会返回2，    16 为 1 0000 就会返回1
     * @param turnedOn
     * @return
     */
    public List<String> readBinaryWatch(int turnedOn) {
        List<String> list = new ArrayList<>();
        for (int h = 0 ; h<12;++h){
            for(int m = 0 ; m<60;++m){
                if (Integer.bitCount(h)+Integer.bitCount(m) == turnedOn){
                    list.add(h + ":" + (m < 10 ? "0" : "") + m);
                }
            }
        }
        return list;
    }
}

class Demo401{
  public static void main(String[] args) {
    System.out.println(Integer.bitCount(16));//2
  }
}